31struct ParamsSensorBase;
32struct ParamsProcessorBase;
50#include "yaml-cpp/yaml.h"
61class Problem :
public std::enable_shared_from_this<Problem>
81 std::map<std::pair<StateBlockConstPtr, StateBlockConstPtr>, Eigen::MatrixXd>
covariances_;
104 static ProblemPtr
autoSetup(
const std::string& _input_yaml_file,
105 std::vector<std::string> _primary_schema_folders = {},
107 bool _skip_yaml_validation =
false);
108 static ProblemPtr
autoSetup(YAML::Node _param_node,
109 std::vector<std::string> _primary_schema_folders = {},
111 bool _skip_yaml_validation =
false);
137 SensorBasePtr
installSensor(YAML::Node _sensor_node, std::vector<std::string> _schema_folders = {});
144 SensorBasePtr
installSensor(
const std::string& _params_yaml_filename, std::vector<std::string> _schema_folders);
151 ProcessorBasePtr
installProcessor(YAML::Node _processor_node, std::vector<std::string> _schema_folders = {});
160 const std::string& _params_yaml_filename,
161 std::vector<std::string> _schema_folders);
172 std::vector<std::string> _schema_folders);
177 SensorBaseConstPtr
findSensor(
const std::string& _sensor_name)
const;
178 SensorBasePtr
findSensor(
const std::string& _sensor_name);
183 ProcessorBaseConstPtr
findProcessor(
const std::string& _processor_name)
const;
184 ProcessorBasePtr
findProcessor(
const std::string& _processor_name);
207 const VectorComposite& _first_frame_values,
210 FrameBasePtr
emplaceFirstFrame(
const TimeStamp& _ts,
const YAML::Node& _first_frame_node);
213 const VectorComposite& _first_frame_values,
229 const VectorComposite& _frame_state,
257 FrameBasePtr
emplaceFrame(
const TimeStamp& _time_stamp,
const VectorComposite& _frame_state);
273 const Eigen::VectorXd& _frame_state);
316 void keyFrameCallback(FrameBasePtr _keyframe_ptr, ProcessorBasePtr _processor_ptr);
329 MapBaseConstPtr
getMap()
const;
332 bool saveMap(
const std::string& _filename_dot_yaml,
333 const std::string& _map_name =
"Map automatically saved by Wolf");
340 void perturb(
double amplitude = 0.01);
342 void transform(
const VectorComposite& _transformation);
349 void addCovarianceBlock(StateBlockPtr _state1, StateBlockPtr _state2,
const Eigen::MatrixXd& _cov);
352 StateBlockConstPtr _state2,
353 Eigen::MatrixXd& _cov,
355 const int _col = 0)
const;
356 bool getCovarianceBlock(std::map<StateBlockConstPtr, unsigned int> _sb_2_idx, Eigen::MatrixXd& _cov)
const;
357 bool getCovarianceBlock(StateBlockConstPtr _state, Eigen::MatrixXd& _cov,
const int _row_and_col = 0)
const;
360 Eigen::MatrixXd& _covariance)
const;
393 void consumeNotifications(std::map<StateBlockPtr, Notification>&, std::map<FactorBasePtr, Notification>&);
413 void print(
int depth = 4,
414 bool factored_by =
false,
416 bool state_blocks =
false,
417 std::ostream& stream = std::cout)
const;
418 bool check(
int verbose_level = 0)
const;
419 bool check(
bool verbose, std::ostream& stream)
const;
455 std::map<unsigned int, MotionProviderConstPtr> map_const;
478 std::map<FactorBasePtr, Notification>& _fac_notification_map)
Definition: motion_provider.h:33
bool getStateBlockNotification(const StateBlockPtr &sb_ptr, Notification ¬if) const
Returns if the state block has been notified, and the notification via parameter.
Definition: problem.cpp:917
bool permitKeyFrame(ProcessorBaseConstPtr _processor_ptr) const
Give the permission to a processor to create a new key Frame.
Definition: problem.cpp:852
ProcessorBaseConstPtr findProcessor(const std::string &_processor_name) const
get a processor pointer by its name
Definition: problem.cpp:444
void addCovarianceBlock(StateBlockPtr _state1, StateBlockPtr _state2, const Eigen::MatrixXd &_cov)
Definition: problem.cpp:969
bool saveMap(const std::string &_filename_dot_yaml, const std::string &_map_name="Map automatically saved by Wolf")
Definition: problem.cpp:1267
void setFirstFrameOptions(const YAML::Node &_first_frame_node)
Definition: problem.cpp:1181
VectorComposite first_frame_values_
Definition: problem.h:77
bool isFirstFrameSpecified() const
Definition: problem.h:443
bool isFirstFrameApplied() const
Definition: problem.h:448
TrajectoryBasePtr trajectory_ptr_
Definition: problem.h:70
void setMap(MapBasePtr)
Definition: problem.cpp:1136
SizeStd getFactorNotificationMapSize() const
Returns the size of the map of factor notification.
Definition: problem.h:471
HardwareBaseConstPtr getHardware() const
Definition: problem.cpp:1151
bool isTransformed() const
Definition: problem.cpp:1365
MapBaseConstPtr getMap() const
Definition: problem.cpp:1126
std::mutex mut_transform_
Definition: problem.h:90
void print(int depth=4, bool factored_by=false, bool metric=true, bool state_blocks=false, std::ostream &stream=std::cout) const
print wolf tree
Definition: problem.cpp:1272
void resetTransformed()
Definition: problem.cpp:1369
void keyFrameCallback(FrameBasePtr _keyframe_ptr, ProcessorBasePtr _processor_ptr)
New key frame callback.
Definition: problem.cpp:863
TreeManagerBaseConstPtr getTreeManager() const
Definition: problem.h:433
TypeComposite frame_types_
Definition: problem.h:76
bool getCovarianceBlock(StateBlockConstPtr _state1, StateBlockConstPtr _state2, Eigen::MatrixXd &_cov, const int _row=0, const int _col=0) const
Definition: problem.cpp:987
LoaderPtr loader_
Definition: problem.h:92
FactorBasePtr notifyFactor(FactorBasePtr _factor_ptr, Notification _notif)
Notifies a new/removed factor to update the solver manager.
Definition: problem.cpp:926
bool getLastFrameCovariance(const StateKeys &_keys, Eigen::MatrixXd &_covariance) const
Definition: problem.cpp:1121
std::map< StateBlockPtr, Notification > consumeStateBlockNotificationMap()
Returns the map of state block notification to be handled by the solver (the map stored in this is em...
static ProblemPtr autoSetup(const std::string &_input_yaml_file, std::vector< std::string > _primary_schema_folders={}, LoaderPtr _loader=nullptr, bool _skip_yaml_validation=false)
Definition: problem.cpp:80
VectorComposite transformation_
Definition: problem.h:89
TypeComposite getFrameTypes(StateKeys _keys) const
Definition: problem.cpp:762
std::map< FactorBasePtr, Notification > factor_notification_map_
Definition: problem.h:83
void perturb(double amplitude=0.01)
perturb all states states with random noise following an uniform distribution in [ -amplitude,...
Definition: problem.cpp:1328
void setTreeManager(TreeManagerBasePtr _gm)
Definition: problem.cpp:794
void transform(const VectorComposite &_transformation)
Definition: problem.cpp:1344
FrameBasePtr emplaceFrame(const TimeStamp &_time_stamp, const TypeComposite &_frame_types, const VectorComposite &_frame_state, const PriorComposite &_frame_priors={})
Emplace frame from timestamp, types and and state.
Definition: problem.cpp:460
StateBlockPtr notifyStateBlock(StateBlockPtr _state_ptr, Notification _notif)
Notifies a new/removed state block to update the solver manager.
Definition: problem.cpp:894
FrameBaseConstPtr getLastFrame() const
Definition: problem.cpp:1161
std::map< unsigned int, MotionProviderConstPtr > getMotionProviderMap() const
Definition: problem.h:453
SizeEigen getDim() const
Definition: problem.cpp:757
bool getCovariance(NodeStateBlocksConstPtr _has_states_ptr, const StateKeys &_keys, Eigen::MatrixXd &_covariance) const
Definition: problem.cpp:1082
SizeEigen dim_
Definition: problem.h:75
static ProblemPtr create(SizeEigen _dim, const TypeComposite &_frame_types={}, LoaderPtr _loader=nullptr)
Definition: problem.cpp:71
SizeStd getStateBlockNotificationMapSize() const
Returns the size of the map of state block notification.
Definition: problem.h:465
virtual ~Problem()
Definition: problem.cpp:192
void addFrameTypes(const TypeComposite &_types)
Definition: problem.cpp:773
LoaderPtr getLoader()
Definition: problem.h:428
void addMotionProvider(MotionProviderPtr _processor_motion_ptr)
Set the processor motion.
Definition: problem.cpp:801
std::atomic_bool transformed_
Definition: problem.h:88
VectorComposite stateZero(TypeComposite _types) const
Definition: problem.cpp:833
void clearCovariance()
Definition: problem.cpp:963
std::map< FactorBasePtr, Notification > consumeFactorNotificationMap()
Returns the map of factor notification to be handled by the solver (the map stored in this is emptied...
FrameBasePtr emplaceFirstFrame(const TimeStamp &_ts, const YAML::Node &_first_frame_node)
Definition: problem.cpp:1252
VectorComposite getState(const StateKeys &_keys) const
Definition: problem.cpp:587
std::mutex mut_covariances_
Definition: problem.h:86
void consumeNotifications(std::map< StateBlockPtr, Notification > &, std::map< FactorBasePtr, Notification > &)
Returns the map of state block notification to be handled by the solver (the map stored in this is em...
Definition: problem.h:477
bool check(int verbose_level=0) const
Definition: problem.cpp:1323
VectorComposite getOdometry(const StateKeys &_keys) const
Definition: problem.cpp:711
std::map< StateBlockPtr, Notification > state_block_notification_map_
Definition: problem.h:84
FrameBaseConstPtr closestFrameToTimeStamp(const TimeStamp &_ts) const
Definition: problem.cpp:1171
VectorComposite getTransformation() const
Definition: problem.cpp:1373
TimeStamp getTimeStamp() const
Definition: problem.cpp:567
bool getFactorNotification(const FactorBasePtr &fac_ptr, Notification ¬if) const
Returns if the factor has been notified, and the notification via parameter.
Definition: problem.cpp:954
FrameBasePtr applyFirstFrameOptions(const TimeStamp &_ts)
Definition: problem.cpp:1225
MapBasePtr map_ptr_
Definition: problem.h:71
ProcessorBasePtr installProcessor(YAML::Node _processor_node, std::vector< std::string > _schema_folders={})
Factory method to install (create, and add to sensor) processors only from a YAML node – Helper metho...
Definition: problem.cpp:288
std::map< std::pair< StateBlockConstPtr, StateBlockConstPtr >, Eigen::MatrixXd > covariances_
Definition: problem.h:81
unsigned int first_frame_status_
0: not set, 1: set, 2: applied
Definition: problem.h:79
HardwareBasePtr hardware_ptr_
Definition: problem.h:69
TreeManagerBasePtr tree_manager_
Definition: problem.h:72
std::map< unsigned int, MotionProviderPtr > motion_provider_map_
Definition: problem.h:73
SensorBasePtr installSensor(YAML::Node _sensor_node, std::vector< std::string > _schema_folders={})
Factory method to install (create and add) sensors only from a YAML node – Helper method loading para...
Definition: problem.cpp:197
SensorBaseConstPtr findSensor(const std::string &_sensor_name) const
get a sensor pointer by its name
Definition: problem.cpp:434
std::mutex mut_notifications_
Definition: problem.h:85
void emplaceStatesToFrame(FrameBasePtr _frame_ptr, const StateKeys &_frame_keys)
Take a frame and emplace to it the missing states with the frame timestamp.
Definition: problem.cpp:526
void removeMotionProvider(MotionProviderPtr proc)
Definition: problem.cpp:826
PriorComposite first_frame_priors_
Definition: problem.h:78
TrajectoryBaseConstPtr getTrajectory() const
Definition: problem.cpp:1141
Definition: processor_base.h:118
class for Motion processors
Definition: processor_motion.h:110
Solver manager for WOLF.
Definition: solver_manager.h:84
Definition: vector_composite.h:27
Definition: capture_base.h:23
std::string StateKeys
Definition: composite.h:31
std::size_t SizeStd
Other containers size type for the Wolf project.
Definition: wolf.h:66
Composite< std::string > TypeComposite
Definition: type_composite.h:26
Notification
Definition: problem.h:55
@ ADD
Definition: problem.h:56
@ REMOVE
Definition: problem.h:57
EIGEN_DEFAULT_DENSE_INDEX_TYPE SizeEigen
Vector and Matrices size type for the Wolf project.
Definition: wolf.h:58
std::shared_ptr< Loader > LoaderPtr
Definition: loader.h:55
Composite< Prior > PriorComposite
Definition: prior_composite.h:56